<template>
  <div class="newInfo-container">
    <h1 class="title">{{ listcontent.title }}</h1>
    <p class="subtitle">
      <span>发布时间：{{ listcontent.add_time | dataFormat }}</span>
      <span>浏览{{ listcontent.click }}次</span>
    </p>
    <hr>

    <div class="newContent" v-html="listcontent.content"></div>

    <comment-box :id='id'></comment-box>
  </div>


</template>

<script>

// 获取评论子组件
import comment from '../subcompoents/comment.vue';

export default {
  data: function() {
    return {
      id: this.$route.params.id,
      listcontent: {}
    };
  },
  created() {
    this.getNewContent();
  },
  methods: {
    getNewContent() {
      this.$http.get("api/getnew/" + this.id).then(function(result) {
        // console.log(result.body.message[0]);
        this.listcontent = result.body.message[0];
      });
    }
  },
  components:{
      "comment-box":comment
  }
};
</script>

<style lang="scss" >
    .newInfo-container{
        padding:0 4px;
        .title{
            font-size:15px;
            color:red;
            text-align:center;
            margin:5px 0px;

        }
        .subtitle{
            font-size:13px;
            color:blue;
            display:flex;
            justify-content:space-between;
            padding:0 5px;
        }
        .newContent{
             p{
                text-indent:2em;
                
            }
        }
  
    }
</style>